<template>
    <v-table
            :searchFlag="false"
            :hasEdit="false"
            :pageSize="pageSize"
            :page="page"
            :tableConfig="tableConfig"
            :tableData="tableData"
            :total="total"
            @findData="getTableData"
            @setdialog="setdialog"
            @getTableData="getTableData"
            @searhData="setSearhData"
            @upData="getTableData"
            ref="table"
    ></v-table>
</template>

<script>
    import table from 'commons/Table'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        name: "CheckDetail",
        mixins: [baseMixin],
        props: {
            inputData: {
                type: Object
            }
        },
        data() {
            return {
                tableConfig: [
                    {
                        label: this.$t('bill.customer'),
                        prop: "storerkey",
                        input: "input",
                    },
                    {
                        label: this.$t('out.orderkey'),
                        prop: "orderkey",
                        input: "input",
                    },
                    {
                        label: this.$t('out.taskgroup'),
                        prop: "taskgroup",
                        input: "input",
                    },
                    {
                        label: this.$t('config.sku'),
                        prop: "sku",
                        input: "input"
                    },
                    {
                        label: this.$t('out.ordernumber'),
                        prop: "originalqty",
                        input: "input",
                    },
                    {
                        label: this.$t('out.checkedqty'),
                        prop: "checkedqty",
                        input: "input",
                    },
                    {
                        label: this.$t('out.weight'),
                        prop: "weight",
                        input: "input",
                    },
                    {
                        label: this.$t('config.volume'),
                        prop: "cube",
                        input: "input",
                    },
                    {
                        label: this.$t('out.cartontype'),
                        prop: "cartontype",
                        input: "input",
                    },
                    {
                        label: this.$t('out.checkid'),
                        prop: "caseid",
                        input: "input",
                    },
                    {
                        label: this.$t('out.dropid1'),
                        prop: "dropid",
                        input: "input",
                    },
                    {
                        label: this.$t('out.checkwho'),
                        prop: "addwho",
                        input: "input",
                    }
                ],
                tableData: [],
                pageSize: 10,
              page: 1,
                total: 10,
                searhData: {}
            }
        },
        methods: {
            //获取table数据
            async getTableData(page, data) {
                try {
                    let res = await this.$api.get(`/queryCheckDetailOrderkey/${this.inputData.orderkey}/${page}`);
                    
                        this.loading = false;
                        this.tableData = res.page.list;
                      this.page = res.page.curpage;
                        this.pageSize = res.page.pageSize;
                        this.total = res.page.total;
                    
                } catch (e) {
                    this.$message.error(e);
                }
            },
            //搜索值
            setSearhData(data, up) {
                if (!up) {
                    this.searhData = data;
                } else {
                    this.searhData = data;
                    this.getTableData(1, this.searhData);
                }
            },
            setdialog(data) {
                this.$parent.detailNav = "10";
                this.$parent.temporary = data;
            },
        },
        mounted() {
            this.getTableData(1, {})
        },
        components: {
            'v-table': table
        }
    }
</script>

<style scoped>

</style>
